package com.inspur.cloud.service.dataspace;

import com.inspur.cloud.configuration.AmbariConfig;
import com.inspur.cloud.entity.dataspace.cache.ClusterInfo;
import com.inspur.cloud.service.ambari.ClustersService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class InfoService {

    @Autowired
    private AmbariConfig ambariConfig;
    @Autowired
    private HttpService httpService;
    @Autowired
    private ClustersService clustersService;

    private static ClusterInfo clusterInfo = new ClusterInfo();

    public String getClusterName() {
        if (StringUtils.isEmpty(clusterInfo.getClusterName())) {
            clusterInfo.setClusterName(clustersService.findClusterName());
        }
        return clusterInfo.getClusterName();
    }
}
